package com.ruoyi.volunteercollege.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.volunteercollege.domain.ExamVolunteerCollege;
import com.ruoyi.volunteercollege.service.IExamVolunteerCollegeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "基础管理-志愿院校")
@RestController
@RequestMapping("/volunteercollege")
public class ExamVolunteerCollegeController {

    @Autowired
    private IExamVolunteerCollegeService volunteerCollegeService;

    /**
     * 查询志愿院校列表
     */
                @ApiOperation("志愿院校管理 - 分页查询列表")
    @GetMapping("/list")
    public AjaxResult list() {
        List<ExamVolunteerCollege> list = volunteerCollegeService.selectVolunteerCollegeList();
        return AjaxResult.success(list);
    }

    /**
     * 根据ID获取志愿院校详情
     */
                @ApiOperation("志愿院校管理 - 根据ID获取详细信息")
    @GetMapping("/info")
    public AjaxResult getInfo(@RequestParam Long id) {
        return AjaxResult.success(volunteerCollegeService.selectVolunteerCollegeById(id));
    }

    /**
     * 新增志愿院校
     */
                @ApiOperation("志愿院校管理 - 新增数据")
    @PostMapping
    public AjaxResult add(@RequestBody ExamVolunteerCollege volunteerCollege) {
        return AjaxResult.success(volunteerCollegeService.insertVolunteerCollege(volunteerCollege));
    }

    /**
     * 修改志愿院校
     */
                @ApiOperation("志愿院校管理 - 修改数据")
    @PutMapping
    public AjaxResult edit(@RequestBody ExamVolunteerCollege volunteerCollege) {
        return AjaxResult.success(volunteerCollegeService.updateVolunteerCollege(volunteerCollege));
    }

    /**
     * 删除志愿院校
     */
                @ApiOperation("志愿院校管理 - 删除数据")
    @DeleteMapping
    public AjaxResult remove(@RequestParam Long id) {
        return AjaxResult.success(volunteerCollegeService.deleteVolunteerCollegeById(id));
    }
}
